﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System.Common.Extensions
{
	public static class NumberExtension
	{
		public static void Times(this int number, Action<int> action)
		{
			if (number > 0)
				for (int i = 0; i < number; i++)
					action(i);
			else
				for (int i = number; i < 0; i++)
					action(i);
		}


		public static void Times(this long number, Action<long> action)
		{
			if (number > 0)
				for (long i = 0; i < number; i++)
					action(i);
			else
				for (long i = number; i < 0; i++)
					action(i);
		}


		public static void Times(this short number, Action<short> action)
		{
			if (number > 0)
				for (short i = 0; i < number; i++)
					action(i);
			else
				for (short i = number; i < 0; i++)
					action(i);
		}


		public static void Times(this uint number, Action<uint> action)
		{
			if (number > 0)
				for (uint i = 0; i < number; i++)
					action(i);
		}


		public static void Times(this ulong number, Action<ulong> action)
		{
			if (number > 0)
				for (ulong i = 0; i < number; i++)
					action(i);
		}


		public static void Times(this ushort number, Action<ushort> action)
		{
			if (number > 0)
				for (ushort i = 0; i < number; i++)
					action(i);
		}


		public static void Times(this byte number, Action<byte> action)
		{
			if (number > 0)
				for (byte i = 0; i < number; i++)
					action(i);
		}


		public static void Times(this float number, Action<float> action)
		{
			if (number > 0)
				for (float i = 0; i < number; i++)
					action(i);
			else
				for (float i = number; i < 0; i++)
					action(i);
		}


		public static void Times(this double number, Action<double> action)
		{
			if (number > 0)
				for (double i = 0; i < number; i++)
					action(i);
			else
				for (double i = number; i < 0; i++)
					action(i);
		}
	}
}